package gokyesil.game.aygitciklar.model;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.lights.Lights;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.physics.box2d.World;

public class Aygit extends Box
{
	public Aygit(World physWorld, float _posX, float _posY)
	{
		super.createBody(physWorld, _posX, _posY);
	}
	
	public void render(SpriteBatch spriteBatch, TextureRegion textureRegion, ModelBatch modelBatch, ModelInstance ins, Lights lights)
	{
		float posX = body.getPosition().x-width/2.0f;
		float posY = body.getPosition().y-height/2.0f;
		float angle = (float)(body.getAngle()*180/Math.PI);
		spriteBatch.draw(textureRegion, posX, posY, width/2.0f, height/2.0f, width, height, 1, 1, angle);
		posX += -12.5f+width/2.0f;
		posY += -7.5f+height/2.0f;
		ins.transform.translate(posX, posY, 0).rotate(new Vector3(0,0,1), angle);
		modelBatch.render(ins,lights);
		ins.transform.rotate(new Vector3(0,0,1), -1*angle).translate(-1*posX, -1*posY, 0);
		
	}
}
